#ifndef _NEW_VIEW_HPP
#define _NEW_VIEW_HPP 1

#include <vector>

#include "../Parameters.hpp"
#include "MacArrayMessage.hpp"

namespace BFT
{
	namespace order
	{
		namespace messages
		{
			class NewView: public BFT::messages::MacArrayMessage
			{
				public:
				
				//k is the number of non-null entrues in chosenvcs
				NewView(uint32_t _view, std::vector<boost::shared_ptr<BFT::messages::Digest> > _chosenvcs,
					uint32_t _sendingReplica, int _k); 
				
				//k is the number of non-null entries in chosenvcs
				//n is the total size of the said array
				NewView(boost::shared_ptr<char> _bytes, int _bytes_size, int _k, int _n);
				
				//TODO: check if the implementation makes sense.
				NewView(boost::shared_ptr<char> _bytes, int _bytes_size);
				
				uint32_t getSendingReplica(); //inlined
				
				uint32_t getView(); //inlined
				
				std::vector<boost::shared_ptr<BFT::messages::Digest> > getChosenVCs(); //inlined
				
				bool equals(boost::shared_ptr<BFT::order::messages::NewView>); 
				
				protected:
				
				uint32_t viewNo;
				
				std::vector<boost::shared_ptr<BFT::messages::Digest> > chosenVCs;
				
				private:
				
				uint32_t computeSize( std::vector<boost::shared_ptr<BFT::messages::Digest> > _vcs, int _k);
			}; 

			inline uint32_t NewView::getSendingReplica() {return getSender();}
			
			inline uint32_t NewView::getView() {return viewNo;}
			
			inline std::vector<boost::shared_ptr<BFT::messages::Digest> > NewView::getChosenVCs()
				{return chosenVCs;}

	
		}
	}
}

#endif
